3.8.89 \(\int (d \cot (e+f x))^n (a+i a \tan (e+f x))^2 \, dx\) [789]

3.8.89.1 Optimal result
3.8.89.2 Mathematica [A] (verified)
3.8.89.3 Rubi [A] (verified)
3.8.89.4 Maple [F]
3.8.89.5 Fricas [F]
3.8.89.6 Sympy [F]
3.8.89.7 Maxima [F]
3.8.89.8 Giac [F]
3.8.89.9 Mupad [F(-1)]

3.8.89.1 Optimal result

Integrand size = 26, antiderivative size = 72 \[ \int (d \cot (e+f x))^n (a+i a \tan (e+f x))^2 \, dx=\frac {a^2 d (d \cot (e+f x))^{-1+n}}{f (1-n)}-\frac {2 a^2 d (d \cot (e+f x))^{-1+n} \operatorname {Hypergeometric2F1}(1,-1+n,n,-i \cot (e+f x))}{f (1-n)} \]

output
a^2*d*(d*cot(f*x+e))^(-1+n)/f/(1-n)-2*a^2*d*(d*cot(f*x+e))^(-1+n)*hypergeo 
m([1, -1+n],[n],-I*cot(f*x+e))/f/(1-n)
 
3.8.89.2 Mathematica [A] (verified)

Time = 1.02 (sec) , antiderivative size = 52, normalized size of antiderivative = 0.72 \[ \int (d \cot (e+f x))^n (a+i a \tan (e+f x))^2 \, dx=-\frac {a^2 d (d \cot (e+f x))^{-1+n} (-1+2 \operatorname {Hypergeometric2F1}(1,1-n,2-n,i \tan (e+f x)))}{f (-1+n)} \]

input
Integrate[(d*Cot[e + f*x])^n*(a + I*a*Tan[e + f*x])^2,x]
 
output
-((a^2*d*(d*Cot[e + f*x])^(-1 + n)*(-1 + 2*Hypergeometric2F1[1, 1 - n, 2 - 
 n, I*Tan[e + f*x]]))/(f*(-1 + n)))
 
3.8.89.3 Rubi [A] (verified)

Time = 0.52 (sec) , antiderivative size = 80, normalized size of antiderivative = 1.11, number of steps used = 10, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.346, Rules used = {3042, 4156, 3042, 4026, 3042, 4020, 25, 27, 74}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (a+i a \tan (e+f x))^2 (d \cot (e+f x))^n \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+i a \tan (e+f x))^2 (d \cot (e+f x))^ndx\)

\(\Big \downarrow \) 4156

\(\displaystyle d^2 \int (d \cot (e+f x))^{n-2} (\cot (e+f x) a+i a)^2dx\)

\(\Big \downarrow \) 3042

\(\displaystyle d^2 \int \left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n-2} \left (i a-a \tan \left (e+f x+\frac {\pi }{2}\right )\right )^2dx\)

\(\Big \downarrow \) 4026

\(\displaystyle d^2 \left (\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}+\int (d \cot (e+f x))^{n-2} \left (2 i a^2 \cot (e+f x)-2 a^2\right )dx\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle d^2 \left (\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}+\int \left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n-2} \left (-2 i \tan \left (e+f x+\frac {\pi }{2}\right ) a^2-2 a^2\right )dx\right )\)

\(\Big \downarrow \) 4020

\(\displaystyle d^2 \left (\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}+\frac {4 i a^4 \int -\frac {(d \cot (e+f x))^{n-2}}{2 a^2 \left (2 i \cot (e+f x) a^2+2 a^2\right )}d\left (2 i a^2 \cot (e+f x)\right )}{f}\right )\)

\(\Big \downarrow \) 25

\(\displaystyle d^2 \left (\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}-\frac {4 i a^4 \int \frac {(d \cot (e+f x))^{n-2}}{2 a^2 \left (2 i \cot (e+f x) a^2+2 a^2\right )}d\left (2 i a^2 \cot (e+f x)\right )}{f}\right )\)

\(\Big \downarrow \) 27

\(\displaystyle d^2 \left (\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}-\frac {i a^2 2^{3-n} \int \frac {2^{n-2} (d \cot (e+f x))^{n-2}}{2 i \cot (e+f x) a^2+2 a^2}d\left (2 i a^2 \cot (e+f x)\right )}{f}\right )\)

\(\Big \downarrow \) 74

\(\displaystyle d^2 \left (\frac {a^2 (d \cot (e+f x))^{n-1}}{d f (1-n)}-\frac {2 a^2 (d \cot (e+f x))^{n-1} \operatorname {Hypergeometric2F1}(1,n-1,n,-i \cot (e+f x))}{d f (1-n)}\right )\)

input
Int[(d*Cot[e + f*x])^n*(a + I*a*Tan[e + f*x])^2,x]
 
output
d^2*((a^2*(d*Cot[e + f*x])^(-1 + n))/(d*f*(1 - n)) - (2*a^2*(d*Cot[e + f*x 
])^(-1 + n)*Hypergeometric2F1[1, -1 + n, n, (-I)*Cot[e + f*x]])/(d*f*(1 - 
n)))
 

3.8.89.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 74
Int[((b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[c^n*((b*x 
)^(m + 1)/(b*(m + 1)))*Hypergeometric2F1[-n, m + 1, m + 2, (-d)*(x/c)], x] 
/; FreeQ[{b, c, d, m, n}, x] &&  !IntegerQ[m] && (IntegerQ[n] || (GtQ[c, 0] 
 &&  !(EqQ[n, -2^(-1)] && EqQ[c^2 - d^2, 0] && GtQ[-d/(b*c), 0])))
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4020
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*tan[(e_.) + 
(f_.)*(x_)]), x_Symbol] :> Simp[c*(d/f)   Subst[Int[(a + (b/d)*x)^m/(d^2 + 
c*x), x], x, d*Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[ 
b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && EqQ[c^2 + d^2, 0]
 

rule 4026
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)])^2, x_Symbol] :> Simp[d^2*((a + b*Tan[e + f*x])^(m + 1)/(b*f*( 
m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Simp[c^2 - d^2 + 2*c*d*Tan[e + f* 
x], x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ 
[m, -1] &&  !(EqQ[m, 2] && EqQ[a, 0])
 

rule 4156
Int[(cot[(e_.) + (f_.)*(x_)]*(d_.))^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x 
_)]^(n_.))^(p_.), x_Symbol] :> Simp[d^(n*p)   Int[(d*Cot[e + f*x])^(m - n*p 
)*(b + a*Cot[e + f*x]^n)^p, x], x] /; FreeQ[{a, b, d, e, f, m, n, p}, x] && 
  !IntegerQ[m] && IntegersQ[n, p]
 
3.8.89.4 Maple [F]

\[\int \left (d \cot \left (f x +e \right )\right )^{n} \left (a +i a \tan \left (f x +e \right )\right )^{2}d x\]

input
int((d*cot(f*x+e))^n*(a+I*a*tan(f*x+e))^2,x)
 
output
int((d*cot(f*x+e))^n*(a+I*a*tan(f*x+e))^2,x)
 
3.8.89.5 Fricas [F]

\[ \int (d \cot (e+f x))^n (a+i a \tan (e+f x))^2 \, dx=\int { {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{2} \left (d \cot \left (f x + e\right )\right )^{n} \,d x } \]

input
integrate((d*cot(f*x+e))^n*(a+I*a*tan(f*x+e))^2,x, algorithm="fricas")
 
output
integral(4*a^2*((I*d*e^(2*I*f*x + 2*I*e) + I*d)/(e^(2*I*f*x + 2*I*e) - 1)) 
^n*e^(4*I*f*x + 4*I*e)/(e^(4*I*f*x + 4*I*e) + 2*e^(2*I*f*x + 2*I*e) + 1), 
x)
 
3.8.89.6 Sympy [F]

\[ \int (d \cot (e+f x))^n (a+i a \tan (e+f x))^2 \, dx=- a^{2} \left (\int \left (- \left (d \cot {\left (e + f x \right )}\right )^{n}\right )\, dx + \int \left (d \cot {\left (e + f x \right )}\right )^{n} \tan ^{2}{\left (e + f x \right )}\, dx + \int \left (- 2 i \left (d \cot {\left (e + f x \right )}\right )^{n} \tan {\left (e + f x \right )}\right )\, dx\right ) \]

input
integrate((d*cot(f*x+e))**n*(a+I*a*tan(f*x+e))**2,x)
 
output
-a**2*(Integral(-(d*cot(e + f*x))**n, x) + Integral((d*cot(e + f*x))**n*ta 
n(e + f*x)**2, x) + Integral(-2*I*(d*cot(e + f*x))**n*tan(e + f*x), x))
 
3.8.89.7 Maxima [F]

\[ \int (d \cot (e+f x))^n (a+i a \tan (e+f x))^2 \, dx=\int { {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{2} \left (d \cot \left (f x + e\right )\right )^{n} \,d x } \]

input
integrate((d*cot(f*x+e))^n*(a+I*a*tan(f*x+e))^2,x, algorithm="maxima")
 
output
integrate((I*a*tan(f*x + e) + a)^2*(d*cot(f*x + e))^n, x)
 
3.8.89.8 Giac [F]

\[ \int (d \cot (e+f x))^n (a+i a \tan (e+f x))^2 \, dx=\int { {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{2} \left (d \cot \left (f x + e\right )\right )^{n} \,d x } \]

input
integrate((d*cot(f*x+e))^n*(a+I*a*tan(f*x+e))^2,x, algorithm="giac")
 
output
integrate((I*a*tan(f*x + e) + a)^2*(d*cot(f*x + e))^n, x)
 
3.8.89.9 Mupad [F(-1)]

Timed out. \[ \int (d \cot (e+f x))^n (a+i a \tan (e+f x))^2 \, dx=\int {\left (d\,\mathrm {cot}\left (e+f\,x\right )\right )}^n\,{\left (a+a\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^2 \,d x \]

input
int((d*cot(e + f*x))^n*(a + a*tan(e + f*x)*1i)^2,x)
 
output
int((d*cot(e + f*x))^n*(a + a*tan(e + f*x)*1i)^2, x)